﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="frm_Tutor.aspx.cs" Inherits="ED_Nivelacion.PresentacionWeb.frm_Tutor" EnableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentCss" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="Form1" runat="server">
    <script>
        $(document).ready(function () {
            $(document).on("click", ".asignar", function () {

                var id = $(this).data("id");

                //alert(id);
                $('#ContentPlaceHolder1_txt_Docente').val(id);

            });

            $(document).on("click", ".borrar", function () {

                var a = $(this).data('idpersona');

                alert(a);
                $('#ContentPlaceHolder1_idEliminar').val(a);

            });


            $(document).on("click", ".editar", function () {

                var nombre = $(this).data("nombre");
                var apellido = $(this).data("apellido");
                var cedula = $(this).data("cedula");
                var tutor = $(this).data("id");


                $('#ContentPlaceHolder1_txtCCTutor').val(cedula);
                $('#ContentPlaceHolder1_txtApellidoT').val(apellido);
                $('#ContentPlaceHolder1_txtNombreT').val(nombre);
                $('#ContentPlaceHolder1_txt_Editar').val(tutor)
                $('#ContentPlaceHolder1_btn_Editar_Tutor').show();
                $('#ContentPlaceHolder1_Btn_Guardar_Tutor').hide();
            });

            $(document).on("click", ".guardar", function () {
                $('#ContentPlaceHolder1_btn_Editar_Tutor').hide();
                $('#ContentPlaceHolder1_Btn_Guardar_Tutor').show();
            });
        });

        function eliminar(persona) {
            // var persona = $(this).data('idpersona');
            //
            // alert(persona);
            $('#ContentPlaceHolder1_idEliminar').val(persona);
        }

        function limpiar() {
            $('#ContentPlaceHolder1_txt_CCDocente').val("");
            $('#ContentPlaceHolder1_txt_ApellidosD').val("");
            $('#ContentPlaceHolder1_txt_NombresD').val("");
            $('#ContentPlaceHolder1_txt_TituloD').val("");
        }


</script>

<%
    ED_Nivelacion.Negocios.Docente_C _objDocente_C = new ED_Nivelacion.Negocios.Docente_C();
    ED_Nivelacion.Negocios.Persona_C _objPersona_C = new ED_Nivelacion.Negocios.Persona_C();
            ED_Nivelacion.Negocios.Tutor_C _objTutor_C = new ED_Nivelacion.Negocios.Tutor_C();
             %>      
                
                <div class="col-lg-22">
                                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                                </asp:ScriptManager>
&nbsp;<asp:Timer ID="Timer1" runat="server">
                                </asp:Timer>

                    <div class="portlet-body">

                                            <div class="panel-body">
                                                 
                                                <div class="portlet portlet-default">
                            <div class="portlet-heading">
                                <div class="portlet-title">
                                    <h4>TUTOR</h4>

                                </div>
                                <div class="clearfix">
                                    <div class ="portlet-widgets"> 
                                        <a class ="btn btn-success btn-xs guardar" data-toggle ="modal" data-target ="#AgregarTutor" onclick="limpiar()"> <i class ="fa fa-plus"> Agregar </i> </a>   
                                    </div>
                                </div>
                            </div>
                            <div class="portlet-body">
                                <div class="table-responsive"> 


                            <div class="portlet-body">
                                <div class="table-responsive"> 
                                    
                                    <table id="example-table" class="table table-striped table-bordered table-hover table-green">
                                        <thead>
                                            <tr>
                                                <th class="auto-style2">#</th>
                                                <th class="auto-style2">NOMBRE(S)</th>
                                                <th class="auto-style2">APELLIDO</th>
                                                <th class="auto-style2">CÉDULA O PASAPORTE</th>
                                                <th class="auto-style2">ACCION</th>
                                            </tr>
                                        </thead>

                                        <tbody>
                                       <% var tutor = _objTutor_C.ObtenerTutoria();
                                          foreach (var item in tutor)
                                          {
                                              
                                           %>
                                            <tr class="odd gradeX">
                                                <td><%=item.idTutor %></td>
                                                <td><%=item.Nombre %></td>
                                                <td><%=item.Apellido %></td>
                                                <td><%=item.Cedula %></td>
                                                <td><a class ="btn btn-orange btn-large editar" data-toggle ="modal" data-target ="#AgregarTutor" data-id="<%=item.idPersona %>" data-nombre="<%=item.Nombre %>" data-apellido="<%=item.Apellido %>" data-cedula="<%=item.Cedula %>"> Modificar </a></td>
                                                
                                            </tr>
               <%} %>
                                        </tbody>

                                    </table>
                                     
                                </div>
                                <!-- /.table-responsive -->
                            </div>
                            <!-- /.portlet-body -->
                                </div>
                                <!-- /.table-responsive -->
                            </div>
                            <!-- /.portlet-body -->
                        </div>


                                            </div>
                                        </div>
                                  
                        
                        <!-- /.portlet -->

                    </div>

       

         <div class="col-lg-22">
    <div class="modal modal-flex fade" id="AgregarTutor" tabindex="-1" role="dialog" aria-labelledby="flexModalLabel" aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                <h4 class="modal-title" id="flexModalLabel">Agregar Tutor</h4>
                                            </div>
                                            <div id="Div1" class="modal-body" runat="server">
                                                <div class="panel panel-default">
 
                            <div class="panel-body form-group">
                                <div class="table-responsive">


                                    <asp:TextBox ID="txt_Editar" runat="server"></asp:TextBox>

                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                            <tr>
                                                <th class="auto-style1">Datos</th>
                                                <th>Tutor</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td class="auto-style1">C.C. o Pasaporte:</td>
                                                 <td class="auto-style1"><asp:TextBox ID="txtCCTutor" runat="server"></asp:TextBox></td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style1">Nombres:</td>
                                                 <td class="auto-style1"><asp:TextBox ID="txtNombreT" runat="server"></asp:TextBox></td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style1">Apellidos:</td>
                                                <td class="auto-style1"><asp:TextBox ID="txtApellidoT" runat="server"></asp:TextBox></td>
                                            </tr>
                                        </tbody>
                                    </table>

                                </div>
                            </div>
                        </div>
                                            </div>
                                            <div class="modal-footer">
                                             <asp:Button ID="Btn_Guardar_Tutor" runat="server" cssclass="btn btn-primary btn-sm" Text="GUARDAR" OnClick="Btn_Guardar_Tutor_Click"/>
                                             <asp:Button ID="btn_Editar_Tutor" runat="server" CssClass=" btn btn-primary btn-sm" Text="EDITAR" OnClick="btn_Editar_Tutor_Click" />

                                            </div>
                                        </div>
                                        <!-- /.modal-content -->
                                    </div>
                                    <!-- /.modal-dialog -->
                                </div>
                                <!-- /.modal --> 
               </div>
       
                <script>
                    $('[data-toggle="confirmation"]').confirmation({
                        placement: 'top', // How to position the confirmation - top | bottom | left | right
                        trigger: 'click', // How confirmation is triggered - click | hover | focus | manual
                        title: 'Esta seguro?', // Default title value if `data-title` attribute isn't present  
                        template: '<div class="popover" >' +
                            '<div class="arrow"></div>' +
                            '<h3 class="popover-title"></h3>' +
                            '<div class="popover-content text-center">' +
                            '<div id="botones" class="btn-group">' +
                            '<a class="btn btn-xs" data-dismiss="confirmation"></a>' +
                            '</div>' +
                            '</div>'
                        , btnOkClass: 'btn-primary'
                        , btnOkIcon: 'fa fa-check-circle'
                        , btnCancelClass: 'btn-danger'
                        , btnOkLabel: 'Si'
                        , btnCancelIcon: 'fa fa-times-circle'
                        , btnCancelLabel: 'No',
                        singleton: true, // Set true to allow only one confirmation to show at a time.
                        popout: false, // Set true to hide the confirmation when user clicks outside of it.
                        onConfirm: function () {

                        }, // Set event when click at confirm button
                        onCancel: function () { }
                    }); // Set event when click at cancel button
    </script>
        </form>
    </asp:Content>
